﻿@using SCMS.Resources
@model SCMS.UI.Models.CompletionCtificate
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "CompletionDiv",
      LoadingElementId = "loading",
      HttpMethod = "Post",
      Url = Url.Action("SaveCC"),
      OnSuccess = "usermsg('" + Resources_frank.Global_String_ProcessCompleted + "');initSorter();sorter.size(20); ",
      OnFailure = "javascript:errormsg()"
  };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>@Resources_frank.CompletionCertificate_Index_Header</h3>
    </div>
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form", @id = "frmCC" }))
    {
        @Html.ValidationSummary(true)
        <br />
        <input type="hidden" id="actionStatus" value="@ViewBag.Response" />
        <input type="hidden" id="statusMsg" value="@ViewBag.msg" />
        
        <table width="98%" align="center" cellpadding="0">
            <tr>
                <th align="center" width="33.3%">
                    @Resources_frank.Global_String_Date
                </th>
                <th align="center" width="33.3%">
                    @Resources_frank.CompletionCertificate_LoadCC_RefNo
                </th>
                <th align="center" width="33.3%">
                    @Resources_frank.Global_String_PurchaseOrder
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.EditorFor(m => m.EntityCC.PreparedOn)
                    @Html.ValidationMessageFor(m => m.EntityCC.PreparedOn, Resources_frank.Global_String_Required)
                </td>
                <td align="center">
                    @Html.TextBoxFor(m => m.EntityCC.RefNumber, new { id = "refNo", @readonly = "readonly" })
                    @Html.ValidationMessageFor(m => m.EntityCC.RefNumber, Resources_frank.Global_String_Required)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.EntityCC.PurchaseOrderId, Model.POItems, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityCC.PurchaseOrderId)
                </td>
            </tr>
            <tr>
                <th align="center">
                    @Resources_frank.Global_String_Office
                </th>
                <th align="center">
                    @Resources_frank.Global_String_ProjectTitle
                </th>
                <th align="center">
                    @Resources_frank.Global_String_Location
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.DropDownListFor(x => x.EntityCC.OfficeId, Model.Offices, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityCC.OfficeId)
                </td>
                <td align="center">
                    @Html.EditorFor(m => m.EntityCC.ProjectTitle)
                    @Html.ValidationMessageFor(m => m.EntityCC.ProjectTitle)
                </td>
                <td align="center">
                    @Html.EditorFor(m => m.EntityCC.Location)
                    @Html.ValidationMessageFor(m => m.EntityCC.Location)
                </td>
            </tr>
            <tr>
                <th align="center">
                    @Resources_frank.Global_String_DRCOffice
                </th>
                <th align="center">
                    @Resources_frank.CompletionCertificate_LoadCC_Confirmed
                </th>
                <th align="center">
                    @Resources_frank.CompletionCertificate_LoadCC_ServiceWorks
                </th>
            </tr>
            <tr>
                <td align="center">
                    @Html.DropDownListFor(x => x.EntityCC.DRCOfficeId, Model.Offices, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityCC.DRCOfficeId)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.EntityCC.ConfirmedBy, Model.Staffs, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityCC.ConfirmedBy)
                </td>
                <td align="center">
                    @Html.DropDownListFor(x => x.EntityCC.WorksService, new SelectList(
                        new List<Object>{ 
                            new { value = Resources_frank.CompletionCertificate_LoadCC_CompletedSatisfactorily , text = Resources_frank.CompletionCertificate_LoadCC_CompletedSatisfactorily },
                            new { value = Resources_frank.CompletionCertificate_LoadCC_OutstandingIssues , text = Resources_frank.CompletionCertificate_LoadCC_OutstandingIssues },
                            new { value = Resources_frank.CompletionCertificate_LoadCC_NotCompleted , text = Resources_frank.CompletionCertificate_LoadCC_NotCompleted }
                        }, "value", "text"), Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.EntityCC.WorksService)
                </td>
            </tr>
            <tr>
                <th>
                    @Resources_frank.Global_String_SubjectPurpose:
                </th>
                <td colspan="2">
                    @Html.TextAreaFor(m => m.EntityCC.Purpose)
                    @Html.ValidationMessageFor(m => m.EntityCC.Purpose)
                </td>
            </tr>
            <tr>
                <th>
                    @Resources_frank.CompletionCertificate_LoadCC_Remarks:
                </th>
                <td colspan="2">@Html.TextAreaFor(m => m.EntityCC.Remarks)
                    @Html.ValidationMessageFor(m => m.EntityCC.Remarks)
                </td>
            </tr>
        </table>
               
        <center>
            <br />
            <input type="submit" class="btn green" value="  @Resources_frank.Global_String_Save  " /></center>
    }
    <br />
</div>
